//统一管理项目全部接口的文件
//获取真实服务器的接口的数据利用当前axios
import request from './request';
//如果获取mock接口的数据，利用底下axios
import mockRequest from './mockRequest';
//商品分类的数据接口
export const reqCategoryList = () => request({ url: '/product/getBaseCategoryList', method: 'get' });
//获取banner数据的接口函数
export const reqGetBannerList = () => mockRequest({ url: '/banner', method: 'get' });
//获取Floor(楼层)数据接口的函数
export const reqGetFloorList = () => mockRequest({ url: `/floor`, method: 'get' });
//搜索产品的接口[真实的接口]
//URL:/api/list   method:post    参数：需要携带
//这个接口【携带参数：最多十个，十个属性可以传递，也可以不传递，但是至少给给服务器携带一个空对象】
export const reqSearchList = (data) => request({ url: "/list", method: 'post', data });
//请求商品详情的接口 /api/item/{ skuId }
export const reqGetDetai = (skuId) => request({
    url: `/item/${skuId}`,
    method: "get"
})
//添加商品信息到购物车的接口
export const reqAddOrUpdateShopcar = (skuId, skuNum) => request({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })
//获取购物车列表的接口
export const reqShopcarList = () => request({ url: "/cart/cartList", method: "get" })
//删除购物车的商品的接口
export const reqDeleteShopCart = (skuId) => request({ url: `/cart/deleteCart/${skuId}`, method: 'delete' })
//修改购物车商品的选中状态的接口
export const reqChangeShopCart = (skuID, isChecked) => request({ url: `/cart/checkCart/${skuID}/${isChecked}` })
//获取验证码的接口
// /api/user/passport/sendCode/{phone}
export const reqGetCode = (phone) => request({ url: `/user/passport/sendCode/${phone}`, method: 'get' })
//注册用户接口
///api/user/passport/register   post
export const reqRegisterUser = (data) => request({ url: `/user/passport/register`, method: 'post', data })
//登陆接口
///api/user/passport/login
export const reqLogin = (data) => request({ url: '/user/passport/login', data, method: 'post' })
//登陆后获取用户信息
///api/user/passport/auth/getUserInfo
export const reqUserInfo = () => request({ url: '/user/passport/auth/getUserInfo', method: 'get' })
//退出登陆接口
///api/user/passport/logout
export const reqLogout = () => request({ url: '/user/passport/logout', method: 'get' })
//获取用户地址信息
///api/user/userAddress/auth/findUserAddressList method:get
export const reqUserAddress = () => request({ url: '/user/userAddress/auth/findUserAddressList', method: 'get' })
//获取订单交易页信息 
///api/order/auth/trade method:get
export const reqOrderInfo = () => request({ url: '/order/auth/trade', method: 'get' })
//提交订单接口
export const reqSubmitOrder = (tradeNo, data) => request({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, data, method: 'post' })


